package cn.edu.huanu.servletlearn;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.BufferedReader;
import java.io.IOException;

/**
 * @author hb
 * @date 2025-09-26 15:35:22
 */
@WebServlet("/register")
public class RegisterServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获得请求数据包的字符编码
        String characterEncoding = request.getCharacterEncoding();
        System.out.println(characterEncoding);
        //设置请求数据包的字符编码
        request.setCharacterEncoding("utf-8");


        String username = request.getParameter("username");
        String password = request.getParameter("password");
        System.out.println(username+": "+password);


    }


}
